package week04.bank;
   // A bank account has a balance that can be changed by
   // deposits and withdrawals.


 public class ContBancar

 {
    /**
       Constructs a bank account with a zero balance.
   */
    public ContBancar()
    {
      sold= 0;
    }

    /**
       Constructs a bank account with a given balance.
       @param initialBalance the initial balance
    */
    public ContBancar(double contInitial)
    {
       sold = contInitial;
    }

    /**
       Deposits money into the bank account.
       @param amount the amount to deposit
    */
    public void depunere(double suma)
    {
       double soldNou = sold + suma;
       sold = soldNou;
    }

    /**
       Withdraws money from the bank account.
       @param amount the amount to withdraw
    */
    public void retragere(double suma )
    {
       double soldNou = sold - suma;
       sold = soldNou;
    }

    /**
       Gets the current balance of the bank account.
       @return the current balance
    */
    public double getSold()
    {
       return sold;
    }
    
    public void transfer(double amount, ContBancar other)
    {
       retragere(amount);
       other.depunere(amount);
    }

    public double sold;
 }
